//
//  AboApplePay.h
//  EyuGameSDK
//
//  Created by 李长春 on 2022/5/12.
//

#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef void(^payCompleteBlock)(NSDictionary *resultDic);
typedef void(^payGetInfoBlock)(int code,NSDictionary *xProducts);
typedef void(^payFailBlock)(NSError *error);

@interface AboApplePay : NSObject

#pragma mark - 实例方法
+(instancetype)sharedInstance;


/// 内购:向苹果发送请求
/// @param productIdentifier 产品ID
/// @param orderId 订单
/// @param money 价格
/// @param cpData 基础参数里面的user参数 CP返回的用户信息
/// @param Success 成功
/// @param Fail 失败
- (void)requestAppleStoreWithProductid:(NSString *)productIdentifier orderId:(NSString* )orderId money:(NSString*)money propName:(NSString*)name cpData:(NSDictionary*)cpData serverMoney:(NSString*)serverMoney currency:(NSString*)currency Success:(payCompleteBlock)Success Fail:(payFailBlock)Fail;

//查询商品价格
- (void)GetAppstoreProductsInfo:(NSArray *)productIdentifiers Success:(payGetInfoBlock)result;

@end


/*
 支付成功率计算 原理
 
 支付取消、支付失败由SDK上报
 支付成功由SDK服务端自行计算
 pay/cancel
 pay/fail
 这两个参与计算 其他上报不算
 
 */


NS_ASSUME_NONNULL_END
